"""
建立表格
"""
from .model_base import *


class Group(BaseTable):
    __database__ = "base"
    group_id = fields.IntField(pk=True, description="分群ID")
    group_name = fields.CharField(max_length=255, description="分群名称")
    group_desc = fields.CharField(max_length=255, description="详细描述")
    group_type = fields.IntField(description="分群类型")
    configs = fields.JSONField(description="分群配置")

    class Meta:
        table = 'data_group'  # 数据库中的表名称
        table_description = '分群列表'


class GroupLink(BaseTable):
    __database__ = "base"
    group_id = fields.IntField(pk=True, description="分群ID")
    link_id = fields.CharField(max_length=255, description="分群名称")

    class Meta:
        table = 'data_group_link'  # 数据库中的表名称
        table_description = '分群内容关联表'


class GroupType(BaseTable):
    __database__ = "base"
    group_type = fields.IntField(pk=True, description="分群类型")
    group_type_key = fields.CharField(max_length=255, description="分群类型宽表名称")
    group_type_name = fields.CharField(max_length=255, description="分群类型名称")

    class Meta:
        table = 'data_group_type'  # 数据库中的表名称
        table_description = '分群内容款表'
